package cn.sc.allinpay.allfavour.business.cashiersell;

import android.os.Bundle;
import android.support.v7.widget.AppCompatTextView;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import butterknife.BindView;
import butterknife.OnClick;
import cn.sc.allinpay.allfavour.R;
import cn.sc.allinpay.allfavour.base.activity.BaseActivity;


/**
 * activity 收银台 卡券电子钱包核销
 * author：pany
 * on 2017/12/1 11:14
 */
public class CashierSellActivity extends BaseActivity<CashierSellContract.View, CashierSellContract.Presenter>
        implements CashierSellContract.View {

    @BindView(R.id.tvTransAmt)
    AppCompatTextView tvTransAmt;//消费金额
    @BindView(R.id.tvDiscountAmt)
    AppCompatTextView tvDiscountAmt;//会员优惠
    @BindView(R.id.llDiscount)
    RelativeLayout llDiscount;//会员视图
    @BindView(R.id.tvCouponsAmt)
    AppCompatTextView tvCouponsAmt;//卡券优惠金额
    @BindView(R.id.llCouponInfo)
    LinearLayout llCouponInfo;//卡券列表
    @BindView(R.id.tvEWalletAmt)
    AppCompatTextView tvEWalletAmt;//电子钱包使用金额
    @BindView(R.id.tvPaidAmt)
    AppCompatTextView tvPaidAmt;//待支付金额

    @Override
    protected int layoutId() {
        return R.layout.activity_cashier_sell;
    }

    @Override
    protected void layoutTitle(View top, AppCompatTextView left, AppCompatTextView title, AppCompatTextView right) {
        title.setText("收银台");
    }

    @Override
    protected CashierSellContract.Presenter bindPresenter() {
        return new CashierSellPresenter();
    }

    @Override
    protected void layoutContent(Bundle savedInstanceState) {

    }

    @Override
    public void showTransAmt(String data) {
        tvTransAmt.setText(data);
    }

    @Override
    public void showDiscountAmt(String data) {
        tvDiscountAmt.setText(data);
    }

    @Override
    public void showCouponsAmt(String data) {
        tvCouponsAmt.setText(data);
    }

    @Override
    public void addCouponView(String couponName, String couponAmt) {
        TextView textView = new TextView(this);
        textView.setTextSize(14);
        textView.setText("   " + couponName + "              " + couponAmt);
        llCouponInfo.addView(textView, new LinearLayout.LayoutParams(
                LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));
    }

    @Override
    public void showEWalletAmt(String data) {
        tvEWalletAmt.setText(data);
    }

    @Override
    public void showPaidAmt(String amt) {
        tvPaidAmt.setText(amt);
    }

    @OnClick(R.id.btnConfirm)
    void btnClick() {
        presenter.sellConfirm();
    }
}
